]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Bug 589437 - Switch to workspace of target app to activate
authorColin Walters <walters@verbum.org>
Wed, 22 Jul 2009 22:57:33 +0000 (18:57 -0400)
committerColin Walters <walters@verbum.org>
Thu, 23 Jul 2009 16:28:31 +0000 (12:28 -0400)
The user explicitly selected a window, so take them to it.

js/ui/appDisplay.js

index adc94cf02bc36688b8e66d354845c30ded3d85d5..2eaf51b4efebec3d6eec052d8b550470af484d4a 100644 (file)
@@ -519,8 +519,17 @@ WellDisplayItem.prototype = {
         if (this._windows.length == 0)
             this.launch();
         else {
+            /* Pick the first window and activate it, switching to its workspace
+             * if necessary.  In the future, we want to have a menu dropdown here. */
             let first = this._windows[0];
-            first.activate(Clutter.get_current_event_time());
+            let firstWorkspace = first.get_workspace();
+            let currentWorkspaceIndex = Shell.Global.get().screen.get_active_workspace_index();
+            let currentWorkspace = Shell.Global.get().screen.get_workspace_by_index(currentWorkspaceIndex);
+            let ts = Clutter.get_current_event_time();
+            if (currentWorkspace != firstWorkspace)
+                firstWorkspace.activate_with_focus(first, ts);
+            else
+                first.activate(ts);
         }
         this.emit('activated');
     },